package ca.etsmtl.log430.lab3;

import java.util.Observable;
/**
 * Upon notification, list all deliveries that are not currently assigned
 * to a driver.
 * 
 * @author MA Bilodeau
 * @version 1.0, 2012-Jun
 */

/*
 * Modification Log **********************************************************
 * 
 * v1.0, Marc-Antoine Bilodeau, 2012-June - Original version.
 * ***************************************************************************
 */

public class ListDeliveriesNotAssignedToDrivers extends Communication{

	
	public ListDeliveriesNotAssignedToDrivers(Integer registrationNumber, String componentName) {
		super(registrationNumber, componentName);
	}
	
	/**
	 * The update() method is an abstract method that is called whenever the
	 * notifyObservers() method is called by the Observable class First we check
	 * to see if the NotificationNumber is equal to this thread's
	 * RegistrationNumber. If they are, then we execute.
	 * 
	 * @see ca.etsmtl.log430.lab3.Communication#update(java.util.Observable,
	 *      java.lang.Object)
	 */
	public void update(Observable thing, Object notificationNumber) {

		if (registrationNumber.compareTo((Integer) notificationNumber) == 0) {
			Displays display = new Displays();
			display.displayDeliveryListNotAssignedToDriver(CommonData.theListOfDeliveries
					.getListOfDeliveries());
		}
	}
	
}
